package com.zhl.study.controller;

import com.alibaba.fastjson.JSONObject;
import com.zhl.study.base.ResponseFactory;
import com.zhl.study.base.Result;
import com.zhl.study.service.MassageService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
/**
 * @author 浩殇
 * @create 2022/12/6--19:59--周二
 * AnalysisController
 */
@RestController
@RequestMapping("/analysis")
public class AnalysisController {
    @Autowired
    private MassageService massageService;
    @PostMapping("/photo")
    @ApiOperation(httpMethod = "POST", value = "这个只能识别到文件头里面的数据")
    public Result<JSONObject> analysisPhoto(@RequestParam("file") MultipartFile file){
        try {
            return massageService.analysis(file);
        } catch (Exception e) {
            e.printStackTrace();
            return ResponseFactory.fail();
        }
    }

}

